package org.bing.engine.core.domain;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class Controller extends Node {
    private static final long serialVersionUID = 1978L;
    private List<ContainerInstance> instances = new ArrayList<ContainerInstance>(); 
    private ControllerGroup group; 
    private String version;
    private Date startTime;
    private Date lastActivityTime;

    public void addInstance(ContainerInstance instance) {
        instances.add(instance);
    }

    public void removeInstance(ContainerInstance instance) {
        // TODO impl
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null || !(obj instanceof Controller)) {
            return false;
        }
        Controller c2 = (Controller) obj;
        if (this.getGlobalId() == null) {
            return c2.getGlobalId() == null;
        } else {
            return this.getGlobalId().equals(c2.getGlobalId());
        }
    }

    public List<ContainerInstance> getInstances() {
        return instances;
    }

    public void setInstances(List<ContainerInstance> instances) {
        this.instances = instances;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public Date getLastActivityTime() {
        return lastActivityTime;
    }

    public void setLastActivityTime(Date lastActivityTime) {
        this.lastActivityTime = lastActivityTime;
    }

    public ControllerGroup getGroup() {
        return group;
    }

    public void setGroup(ControllerGroup group) {
        this.group = group;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }
}
